<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<script type="text/javascript">
	function menuTree_onNodeClick(event, treeId, treeNode) {
		//alert(treeNode.treenodePath);
		//alert(	JSON.stringify(treeNode));

		menuGrid.search({
			"field" : "parent_id",
			"op" : "eq",
			"data" : treeNode.id
		});
	}
	
	function getMenuTreeNode() {
		var node = menuTree.getSelectedNode();
		if (node !=undefined) {
			return "parentId=" + node.id;
		}
		alert("请选择节点！");
		return false;
	}
</script>
<div class="box no-border clearfix">

	<div class="box-left" style="width:280px">
		<isperp:tree id="menuTree" cusEditUrl="app/menu/edit"
			cusDeleteUrl="app/settingConfig/delete">
			<isperp:async enable="true" url="app/menu/getTree?showRoot=1">
			</isperp:async>
			<isperp:callback onClick="menuTree_onNodeClick">
			</isperp:callback>
			<isperp:edit enable="true" showRemoveBtn="false"
				showRenameBtn="false"></isperp:edit>
			<isperp:view showTitle="false" addHoverDom="menuTree.addHoverDom"
				removeHoverDom="menuTree.removeHoverDom"></isperp:view>
		</isperp:tree>
	</div>

	<div class="box-right" style="margin-left:290px">

		<div class="box no-border">
			<div class="header">
				<h2>子系统菜单详细列表</h2>
			</div>

			<isperp:grid url="app/menu/list" gridId="menuGrid"
				gridTitle="${pageTitle}" cusFormatterActions="true"
				cusEditUrl="app/menu/edit" cusDeleteUrl="app/menu/delete"
				ondbClickRowEvent="menuGrid.edit(rowid);" showSearchbar="false"
				beforeCreateAction="getMenuTreeNode();" cusDialogSize="normal"
				afterActionsSuccess="menuTree.reload();">

				<jsp:attribute name="toolbar">
	 				<isperp:toolbar id="menuToolbar">
		 				<isperp:button id="menuCreate" cssClass="nui-mainbtn" icon="icon-plus" text="新增下级菜单"
							onclick="menuGrid.create();"></isperp:button>
		 				 
	 				</isperp:toolbar>
				 </jsp:attribute>
				<jsp:body> 
					<isperp:column name="id" title="id" hidden="true"></isperp:column>
					<isperp:column name="parentId" title="parentId" hidden="true"></isperp:column>
					<isperp:column name="name" title="名称" width="100">
					</isperp:column>
					<isperp:column name="treenodeNamePath" title="路径" width="200">
					</isperp:column>
				    <isperp:column name="url" title="节链接地址" width="200">
					</isperp:column>
					
					<isperp:column name="useForWebos" title="webos" width="50"
						align="center" formatter="checkbox">
					</isperp:column>
					<isperp:column name="orderNum" align="center" title="排序" width="40">
					</isperp:column>
				</jsp:body>

			</isperp:grid>
		</div>
	</div>
</div>
